package cn.wolfcode.trip.base.mapper;

import cn.wolfcode.trip.base.domain.Order;
import cn.wolfcode.trip.base.domain.User;
import cn.wolfcode.trip.base.query.UserQueryObject;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface UserMapper {
    /**
     * 添加用户
     * @param user 用户对象
     * @return 主键id
     */
    int insert(User user);

    /**
     * 按id查找用户
     * @param id 用户id
     * @return 用户对象
     */
    User selectByPrimaryKey(Long id);

    /**
     * 查找所有用户
     * @return 用户集合
     */
    List<User> selectForList(UserQueryObject qo);

    /**
     * 更新用户信息
     * @param user 用户对象
     * @return
     */
    int updateByPrimaryKey(User user);

   User selectByEmailAndPassword(@Param("email") String email, @Param("password") String password);

    User selectCoverUrl(User user);

    Map<String, Object> getCounts(String keyword);


    Map<String, Object> selectAandF(Long id);


    void saveAttention(@Param("userId") Long userId, @Param("hearImgUrlId") Long hearImgUrlId);

    void saveFancier(@Param("userId") Long userId, @Param("hearImgUrlId") Long hearImgUrlId);

    void updateAttention(@Param("userId") Long userId, @Param("hearImgUrlId") Long hearImgUrlId);

    void updateFancier(@Param("userId") Long userId, @Param("hearImgUrlId") Long hearImgUrlId);


    Map<String,Object> selectStateByUserId(@Param("userId") Long userId, @Param("hearImgUrlId") Long hearImgUrlId);

    void saveUAndTRelation(Order order);

    List<Order> selectForUserOrder(UserQueryObject qo);
}